package com.zhaowenhao.controller;

import com.zhaowenhao.bean.Department;
import com.zhaowenhao.bean.Msg;
import com.zhaowenhao.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Description:公寓信息处理器
 * User: zwh
 * Date: 2019-06-06
 * Time: 21:09
 */
@Controller
public class DepartmentsController {

    @Autowired
    private DepartmentService departmentService;

    /**
     * 得到所有的公寓信息
     *
     * @return
     */
    @RequestMapping("/deps")
    @ResponseBody
    public Msg getDeps() {
        List<Department> deps = departmentService.getAllDeps();
        return Msg.success().addExtend("deps", deps);
    }
}
